package miiteen.demo.web.service;

import miiteen.data.dao.BaseDao;
import miiteen.data.service.impl.BaseServiceImpl;
import miiteen.demo.web.beans.CommentInfo;

import miiteen.demo.web.dao.CommentInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Service("commentInfoService")
public class CommentInfoService extends BaseServiceImpl<CommentInfo> {


    @Autowired
    private CommentInfoDao commentInfoDao;


    @Override
    protected BaseDao<CommentInfo> getDao() {
        return commentInfoDao;
    }



    @Override
    public long save(CommentInfo commentInfo){
      if(commentInfo.getId()>0){
          commentInfo.setCommentTime(new Date());
          commentInfo.setUpdateTime(new Date());
      }else{
          commentInfo.setCommentTime(new Date());
          commentInfo.setCreateTime(new Date());
      }
      long result=commentInfoDao.save(commentInfo);
        return result;
    }

    public long deleteSingle(String id){
        return commentInfoDao.deleteSingle(id);
    }


}
